package day02;

import day02.db.DataSource;
import day02.entity.User;
import day02.service.Impl.UserServiceImpl;
import day02.service.UserService;

import java.util.List;

public class Application {

    private static UserService userService = new UserServiceImpl(
            new DataSource("com.mysql.jdbc.Driver",
                "jdbc:mysql://localhost:3306/sx?useSSL=false",
                "root",
                ""));

    public static void main(String[] args) {
//        增
        userService.saveUser(new User("13", "bbb", 20, 100));
//        删
        userService.deleteUser("13");
//        改
        userService.updateUser(new User("12", "fighYo", 21, 10));
//        查全部
        List<User> users = userService.getUsers();
        System.out.println(users);
//        按ID查
        User user = userService.getUserById("12");
        System.out.println(user);
    }
}

